<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>spsend</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="sprintfk.html" title="sprintfk" />
    <link rel="next" href="sqrt.html" title="sqrt" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">spsend</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="sprintfk.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="sqrt.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="spsend"></a>
      <div class="titlepage"></div>
      <a id="IndexSpsend" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">spsend</span>
        </h2>
        <p>spsend — 
      Generates output signals based on a previously defined <span class="emphasis"><em>space</em></span> opcode.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp151324048"></a>
        <h2>Description</h2>
        <p>
      <span class="emphasis"><em>spsend</em></span> depends upon the existence of a previously defined <a class="link" href="space.html" title="space"><em class="citetitle">space</em></a>. The output signals from <span class="emphasis"><em>spsend</em></span> are derived from the values given for xy and reverb in the <span class="emphasis"><em>space</em></span> and are ready to be sent to local or global reverb units (see example below).
    </p>
      </div>
      <div class="refsect1">
        <a id="idp151327648"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">a1, a2, a3, a4 <span class="command"><strong>spsend</strong></span></pre>
      </div>
      <div class="refsect1">
        <a id="idp151394976"></a>
        <h2>Performance</h2>
        <p>
      The configuration of the xy coordinates in space places the signal in the following way:
      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" style="list-style-type: disc; ">
            <li class="listitem">
              <p>a1 is -1, 1</p>
            </li>
            <li class="listitem">
              <p>a2 is 1, 1</p>
            </li>
            <li class="listitem">
              <p>a3 is -1, -1</p>
            </li>
            <li class="listitem">
              <p>a4 is 1, -1</p>
            </li>
          </ul>
        </div>
        <p>
    </p>
        <p>
      This assumes a loudspeaker set up as a1 is left front, a2 is right front, a3 is left back, a4 is right back. Values greater than 1 will result in sounds being attenuated, as if in the distance. <span class="emphasis"><em>space</em></span> considers the speakers to be at a distance of 1; smaller values of xy can be used, but <span class="emphasis"><em>space</em></span> will not amplify the signal in this case. It will, however balance the signal so that it can sound as if it were within the 4 speaker <span class="emphasis"><em>space</em></span>.  x=0, y=1, will place the signal equally balanced between left and right front channels, x=y=0 will place the signal equally in all 4 channels, and so on. Although there must be 4 output signals from <span class="emphasis"><em>space</em></span>, it can be used in a 2 channel orchestra. If the xy's are kept so that Y&gt;=1, it should work well to do panning and fixed localization in a stereo field.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp151403088"></a>
        <h2>Examples</h2>
        <p>
      Here is a stereo example of the spsend opcode. It uses the file <a class="ulink" href="examples/spsend.csd" target="_top"><em class="citetitle">spsend.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp151404944"></a>
          <p class="title">
            <strong>Example 838. Example of the spsend opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac   <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o spsend.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100 
<span class="ohdr">ksmps</span> <span class="op">=</span> 32 
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1 
<span class="ohdr">nchnls</span> <span class="op">=</span> 2	<span class="comment">;stereo output</span>
  
ga1 <span class="opc">init</span> 0
ga2 <span class="opc">init</span> 0

<span class="oblock">instr</span> 1	<span class="comment">;sends different amounts to reverb</span>

irev <span class="op">=</span> p6
asig <span class="opc">diskin2</span> "fox.wav", 1
a1, a2, a3, a4 <span class="opc">space</span> asig, 0, 0, irev, p4, p5	<span class="comment">;take position values from p4, p5</span>
ar1, ar2, ar3, ar4 <span class="opc">spsend</span>			<span class="comment">;send to reverb</span>

ga1 <span class="op">=</span> ga1<span class="op">+</span>ar1
ga2 <span class="op">=</span> ga2<span class="op">+</span>ar2
    <span class="opc">outs</span> a1, a2

<span class="oblock">endin</span>

<span class="oblock">instr</span> 99 <span class="comment">; reverb instrument</span>

a1 <span class="opc">reverb2</span> ga1, 2.5, .5
a2 <span class="opc">reverb2</span> ga2, 2.5, .5
   <span class="opc">outs</span>	a1, a2

ga1<span class="op">=</span>0
ga2<span class="op">=</span>0

<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="comment">;WITH REVERB</span>
<span class="comment">;place the sound in the left speaker and near</span>
<span class="stamnt">i</span>1 0 1 -1 1 .1
<span class="comment">;place the sound in the right speaker and far</span>
<span class="stamnt">i</span>1 1 1 45 45 .1
<span class="comment">;place the sound equally between left and right and in the middle ground distance</span>
<span class="stamnt">i</span>1 2 1 0 12 .1

<span class="comment">;NO REVERB</span>
<span class="comment">;place the sound in the left speaker and near</span>
<span class="stamnt">i</span>1 6 1 -1 1 0
<span class="comment">;place the sound in the right speaker and far</span>
<span class="stamnt">i</span>1 7 1 45 45 0
<span class="comment">;place the sound equally between left and right and in the middle ground distance</span>
<span class="stamnt">i</span>1 8 1 0 12 0

<span class="stamnt">i</span> 99 0 12	<span class="comment">;keep reverb active all the time</span>
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp151409232"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="space.html" title="space"><em class="citetitle">space</em></a>,
      <a class="link" href="spdist.html" title="spdist"><em class="citetitle">spdist</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp151412240"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Richard Karpen</td>
          </tr>
          <tr>
            <td>Seattle, WA USA</td>
          </tr>
          <tr>
            <td>1998</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 3.48</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="sprintfk.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="sqrt.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">sprintfk </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> sqrt</td>
        </tr>
      </table>
    </div>
  </body>
</html>
